package com.design.strategy.supermarket;

/**
 * Created by yijy on 2018/1/16.
 */
public class ReturnPriceStrategy implements PricesStrategyInterface {

    private float mPrice; // 用户购买总价
    private float mReturnPriceStandard; // 返现标准
    private float mReturnPrice; // (满足返现标准) 返现金额

    public ReturnPriceStrategy(float mPrice, float mReturnPriceStandard, float mReturnPrice) {
        this.mPrice = mPrice;
        this.mReturnPriceStandard = mReturnPriceStandard;
        this.mReturnPrice = mReturnPrice;
    }

    @Override
    public float resultPrices() {
        if(mPrice>=mReturnPriceStandard){
            return mPrice-(mPrice/mReturnPriceStandard)*mReturnPrice;
        }
        return mPrice;
    }
}
